<!--
***********************************************************************************************
Microsoft.NETFramework.targets

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

This file contains .net framework specific properties, items and targets. They are factored into a Microsoft.NETFramework.targets and Microsoft.NetFramework.props
these two files are used to encapsulate the multi-targeting and framework specific build process.

Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
     <ImportByWildcardBeforeMicrosoftNetFrameworkTargets Condition="'$(ImportByWildcardBeforeMicrosoftNetFrameworkTargets)' == ''">true</ImportByWildcardBeforeMicrosoftNetFrameworkTargets>
     <ImportByWildcardAfterMicrosoftNetFrameworkTargets Condition="'$(ImportByWildcardAfterMicrosoftNetFrameworkTargets)' == ''">true</ImportByWildcardAfterMicrosoftNetFrameworkTargets>
     <ImportUserLocationsByWildcardBeforeMicrosoftNetFrameworkTargets Condition="'$(ImportUserLocationsByWildcardBeforeMicrosoftNetFrameworkTargets)' == ''">true</ImportUserLocationsByWildcardBeforeMicrosoftNetFrameworkTargets>
     <ImportUserLocationsByWildcardAfterMicrosoftNetFrameworkTargets Condition="'$(ImportUserLocationsByWildcardAfterMicrosoftNetFrameworkTargets)' == ''">true</ImportUserLocationsByWildcardAfterMicrosoftNetFrameworkTargets>
  </PropertyGroup>

  <Import Project="$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore\*" Condition="'$(ImportUserLocationsByWildcardBeforeMicrosoftNetFrameworkTargets)' == 'true' and exists('$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore')"/>
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftNetFrameworkTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore')"/>
  
  <PropertyGroup>
     <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
  </PropertyGroup>

  <Target
      Name="GetFrameworkPaths"
      DependsOnTargets="$(GetFrameworkPathsDependsOn)">

    <!-- For backwards compatibility of targets who replaced this target we cannot move these values outside the target even though they 
             now only depend on statically availiable values-->

    <ItemGroup>
      <!-- This will only be MsBuildRuntimeVersion until the decision is made as to the final directory name-->
      <_TargetFramework40DirectoryItem Include="$(MSBuildToolsRoot)v$(MSBuildRuntimeVersion)"/>
      <_TargetFramework35DirectoryItem Include="$(MSBuildToolsRoot)v3.5"/>
      <_TargetFramework30DirectoryItem Include="$(MSBuildToolsRoot)v3.0"/>
      <_TargetFramework20DirectoryItem Include="$(MSBuildToolsRoot)v2.0.50727"/>

      <_TargetedFrameworkDirectoryItem Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Include="@(_TargetFramework20DirectoryItem)"/>
      <_TargetedFrameworkDirectoryItem Condition="'$(TargetFrameworkVersion)' == 'v4.0'" Include="@(_TargetFramework40DirectoryItem)"/>
      <_TargetedFrameworkDirectoryItem Condition="'@(_TargetedFrameworkDirectoryItem)' == ''" Include="$(MSBuildToolsRoot)\$(TargetFrameworkVersion)"/>
    </ItemGroup>

    <ItemGroup>
      <_CombinedTargetFrameworkDirectoriesItem Condition=" '$(TargetFrameworkVersion)' == 'v4.0' "
                                               Include="@(_TargetFramework40DirectoryItem)" />

      <_CombinedTargetFrameworkDirectoriesItem Condition=" '$(TargetFrameworkVersion)' == 'v3.5'"
                                               Include="@(_TargetFramework35DirectoryItem)"/>

      <_CombinedTargetFrameworkDirectoriesItem Condition=" '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5'"
                                               Include="@(_TargetFramework30DirectoryItem)" />

      <_CombinedTargetFrameworkDirectoriesItem Condition=" '$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5'"
                                               Include="@(_TargetFramework20DirectoryItem)" />

      <_CombinedTargetFrameworkDirectoriesItem Condition=" '@(_CombinedTargetFrameworkDirectoriesItem)' == ''"
                                                 Include="@(_TargetedFrameworkDirectoryItem)" />

    </ItemGroup>

    <PropertyGroup>
      <TargetFrameworkDirectory>@(_CombinedTargetFrameworkDirectoriesItem)</TargetFrameworkDirectory>
      <TargetFrameworkSDKDirectory>$(FrameworkSDKRoot)</TargetFrameworkSDKDirectory>
    </PropertyGroup>

    <ItemGroup>
      <_TargetFrameworkSDKDirectoryItem Include="$(TargetFrameworkSDKDirectory)"/>
    </ItemGroup>
  </Target>

  <PropertyGroup>
    <ResolveReferencesDependsOn>
      $(ResolveReferencesDependsOn);
      ImplicitlyExpandDesignTimeFacades
    </ResolveReferencesDependsOn>

    <ImplicitlyExpandDesignTimeFacadesDependsOn>
      $(ImplicitlyExpandDesignTimeFacadesDependsOn);
      GetReferenceAssemblyPaths
    </ImplicitlyExpandDesignTimeFacadesDependsOn>
  </PropertyGroup>
  
  <!-- Implicitly references all portable design-time facades if the user is referencing a System.Runtime-based portable library -->
  <Target Name="ImplicitlyExpandDesignTimeFacades" Condition="'$(ImplicitlyExpandDesignTimeFacades)' == 'true'" DependsOnTargets="$(ImplicitlyExpandDesignTimeFacadesDependsOn)">

    <PropertyGroup>
      <!-- Does one of our dependencies reference a System.Runtime-based portable library? -->
      <_HasReferenceToSystemRuntime Condition="'%(ReferenceDependencyPaths.Filename)' == 'System.Runtime'">true</_HasReferenceToSystemRuntime>
    </PropertyGroup>

    <ItemGroup Condition="'$(_HasReferenceToSystemRuntime)' == 'true'">
      <_DesignTimeFacadeAssemblies Include="%(DesignTimeFacadeDirectories.Identity)*.dll"/>
      <!-- If the user has manually referenced these assemblies, remove them so we don't end up with duplicates -->
      <ReferencePath Remove="@(_DesignTimeFacadeAssemblies)"/>
      <ReferencePath Include="%(_DesignTimeFacadeAssemblies.Identity)">
        <WinMDFile>false</WinMDFile>
        <CopyLocal>false</CopyLocal>
        <ResolvedFrom>ImplicitlyExpandDesignTimeFacades</ResolvedFrom>
      </ReferencePath>
      <_ResolveAssemblyReferenceResolvedFiles Include="@(ReferencePath)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandDesignTimeFacades'" />
    </ItemGroup>

    <Message Importance="Low" Text="Including @(ReferencePath)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandDesignTimeFacades'" />

  </Target>


  <Import Project="$(MSBuildToolsPath)\Microsoft.WinFX.targets" Condition="'$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetCompactFramework)' != 'true' and Exists('$(MSBuildToolsPath)\Microsoft.WinFX.targets')"/>
  <Import Project="$(MSBuildToolsPath)\Microsoft.Data.Entity.targets" Condition="'$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetFrameworkVersion)' !=  'v3.0' and Exists('$(MSBuildToolsPath)\Microsoft.Data.Entity.targets')"/>
  
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftNetFrameworkTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter')"/>
  <Import Project="$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter\*" Condition="'$(ImportUserLocationsByWildcardAfterMicrosoftNetFrameworkTargets)' == 'true' and exists('$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter')"/>

</Project>